home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
kermit.columbia.edu
/
kermit.columbia.edu.tar
/
kermit.columbia.edu
/
newsgroups
/
misc.20041116-20060924
/
000312_rock_spambust_violin@yahoo.com_Tue Apr 25 12:14:03 2006.msg
< prev
next >
Wrap
Internet Message Format
|
2006-09-27
|
4KB
Path: newsmaster.cc.columbia.edu!newsfeed.nyu.edu!news.maxwell.syr.edu!newsfeed.media.kyoto-u.ac.jp!border2.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!postnews.google.com!i40g2000cwc.googlegroups.com!not-for-mail
From: "tomviolin" <rock_spambust_violin@yahoo.com>
Newsgroups: comp.protocols.kermit.misc
Subject: Re: speed of script execution
Date: 20 Apr 2006 10:29:35 -0700
Organization: http://groups.google.com
Lines: 57
Message-ID: <1145554175.676504.188370@i40g2000cwc.googlegroups.com>
References: <1145524573.729587.320320@z34g2000cwc.googlegroups.com>
<slrne4f65k.djh.fdc@sesame.cc.columbia.edu>
NNTP-Posting-Host: 67.53.150.18
Mime-Version: 1.0
Content-Type: text/plain; charset="iso-8859-1"
X-Trace: posting.google.com 1145554180 10328 127.0.0.1 (20 Apr 2006 17:29:40 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Thu, 20 Apr 2006 17:29:40 +0000 (UTC)
User-Agent: G2/0.2
X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.2) Gecko/20060308 Firefox/1.5.0.2,gzip(gfe),gzip(gfe)
Complaints-To: groups-abuse@google.com
Injection-Info: i40g2000cwc.googlegroups.com; posting-host=67.53.150.18;
posting-account=ornCOQwAAAAyCG4a7NOAj_SMr54FiqNu
Xref: newsmaster.cc.columbia.edu comp.protocols.kermit.misc:15567
Frank da Cruz wrote:
> On 2006-04-20, tomviolin <rock_spambust_violin@yahoo.com> wrote:
> : Can anyone tell me why there is such a huge time discrepency between
> : the execution of the following scripts. The only difference is the
> : curly braces.
> As in C, the braces mark a block, entry to and exit from which carries some
> setup and takedown cost. When you have only one or two statements in the
> block, that cost is a lot higher, proportionally, than if you have a lot of
> statements in it.
>
> Block structure is a convenience and an aid to writing readable source code,
> but it's not a necessity. Every block structure can be decomposed into
> something more rudimentary and lest costly in execution, using GOTOs or
> whatever. In fact, that's what happens internally anyway. The only
> difference is that with true blocks, various buffers and variables and other
> context have to be stacked.
>
Frank,
I have had an idea. I am somewhat familiar with how Kermit breaks down
structured code into GOTOs and the like (the code shows up when you
have SET MACRO ECHO ON for example).
What if there was a way to do that decomposition in a function and then
save the results to a new command file? For example, part of my
"larger system" does this:
-- begin kermit script --
take \m(connect_id).ksc ; always contains gd_connect
; and gd_disconnect macro definitions
take \m(device_id).ksc ; always contains a gd_acquire macro
definition
fopen /write \%f "getdata.ksc" ; to be executed later
fwrite /line \%f "\m(gd_connect)"
fwrite /line \%f "\m(gd_acquire)"
fwrite /line \%f "\m(gd_disconnect)"
fclose \%f
This basically turns a set of macros into inline code to be executed
later. This works great for very simple macro definitions that have no
blocks in them. As soon as blocks are introduced, wham, the execution
time goes way up.
What I'm proposing is some function \fdecompose() that could perhaps be
called like this:
\fdecompose(\m(gd_connect))
that would take the "inlining" process to the next level, and produce
the lower-level code with all the "goto .._blah" stuff, sort of like
compiling to p-code in a way.
Or, is there a way to do this already?
-Tom